package com.mars.admin.framework.util;

import com.mars.admin.common.request.activity.ActivityRequest;
import com.mars.admin.framework.exception.BusinessException;

public class ActivityUtil {


    /**
     * 校验发布活动请求参数
     *
     * @param request 请求参数
     * @return 错误信息
     */
    public static void validatePublishRequest(ActivityRequest request) {
        // 标题
        if (request.getTitle() == null || request.getTitle().isEmpty()) {
            throw new BusinessException("标题不能为空");
        }
        // 开始时间
        if (request.getStartTime() == null) {
            throw new BusinessException("开始时间不能为空");
        }
        // 结束时间
        if (request.getEndTime() == null) {
            throw new BusinessException("结束时间不能为空");
        }
        // 地址
        if (request.getAddress() == null || request.getAddress().isEmpty()) {
            throw new BusinessException("地址不能为空");
        }
    }

}
